import {createRouter, createWebHistory, RouteRecordRaw} from "vue-router";

export const constantRoutes: RouteRecordRaw[] = [
    {
        path: "/home",
        component: () => import("@/views/home/index.vue"),
        name: "代码生成-首页"
    },
    {
        path: "/gen",
        component: () => import("@/views/gen/index.vue"),
        name: "代码生成-生成表管理"
    },
    {
        path: "/gen-edit/:tableId(\\d+)",
        component: () => import("@/views/gen/editTable.vue"),
        name: "代码生成-生成信息编辑"
    },
    {
        path: "/404",
        component: () => import("@/views/404/index.vue"),
        name: "未知页面"
    },
    {path: "/:catchAll(.*)", redirect: "/404"},
];

const router = createRouter({
    // HTML5 模式路由
    history: createWebHistory(),
    routes: constantRoutes,
});

export default router;
